package kr.co.doriclassic.pro10;

import java.util.Scanner;

class Student{
	private int student, sum;
	private int[] score;
	double average;
	public Student() {
		student = 0;
		score = null;
		sum = 0;
		average = 0.0;
	}
	public Student(int student) {
		this();
		this.student=student;
		score = new int[student];
	}
	public void setScore(){
		Scanner sc = new Scanner(System.in);
		for(int i=0;i<student;i++){
			
				System.out.print(i+1+"학생의 점수:");
				score[i]=sc.nextInt();
				if(score[i]>0&&score[i]<101){
					continue;
				}
				else{
					System.out.println("잘못 입력되었습니다. 다시 입력하세요.");
					i--;
				}
		}
		getAverage();
	}	
	public double getAverage(){
		for(int i=0;i<student;i++){
			sum+=score[i];
		}
		average = sum/(double)student; 
		return average;
	}
	@Override
	public String toString() {		
		return "[ 학생들의 평균=" + average + "]";
	}	
}

public class StudentTest {
	public static void main(String[] args) {
		int cnt=-1;
		Scanner sc = new Scanner(System.in);
		System.out.print("학생 수 입력:");
		cnt = sc.nextInt();
		
		Student s = new Student(cnt);
		s.setScore();	
		System.out.println(s);
	}
}
